package fr.afcepf.atod18.utilitaires.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;

//Annotations
@Entity
@Table
public class Ville {
	
	@Id
    @GeneratedValue(strategy=GenerationType.AUTO)
	private int id;
	
	@Column(nullable=false)
	private String nomVille;
	
	@Column(nullable=false)
	private int codePostal;
	
	
	@OneToMany(cascade=CascadeType.ALL)
	@JoinTable(name="Ville_Rue",joinColumns={@JoinColumn(name="Ville_id")}, inverseJoinColumns={@JoinColumn(name="Rue_id")})
	private List<Rue> rues ;
	
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getNomVille() {
		return nomVille;
	}
	public void setNomVille(String nomVille) {
		this.nomVille = nomVille;
	}
	public int getCodePostal() {
		return codePostal;
	}
	public void setCodePostal(int codePostal) {
		this.codePostal = codePostal;
	}
	public List<Rue> getRues() {
		return rues;
	}
	public void setRues(List<Rue> rues) {
		this.rues = rues;
	}
	
	

}
